package com.jumlabs.web;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jumlabs.data.entities.drive.File;
import com.jumlabs.services.drive.DriveService;
import java.util.List;

@Controller
public class DriveController {
	@Autowired
	private DriveService driveService;
	
	@RequestMapping(value="/drives/{driveId}/rootfiles", method = RequestMethod.GET)
	public @ResponseBody List<File> getRootFiles(@PathVariable String driveId){
		List<File> rootFiles=driveService.listRootFiles(driveId);
		return rootFiles;
	}
	
	@RequestMapping(value="/folders/{folderId}/files",method=RequestMethod.GET)
	public @ResponseBody List<File> getFolderFiles(@PathVariable String folderId){
		List<File> children=driveService.listChildren(folderId);
		return children;
	}
}
